$(function () {
  $.ajax({
    type: "get",
    url: "../interface/getItems.php",
    dataType: "json"
  }).then(res => {

    let template = '';

    res.forEach(elm => {

      let pic = JSON.parse(elm.picture);
      // console.log(pic);

      template +=
       `<a href="./dome03.html?id=${elm.id}" id=${elm.id}>
      <img src="./${pic[0].src}" alt="">
      <p class="pro-p-one">${elm.title}</p>
      <p class="pro-p-two">${elm.details}</p>
      <p class="pro-p-three">${elm.price}元起</p>
  </a>`;
    });

    $('.items').html(template);

  }).catch(xhr => {
    console.log(xhr.status);
  });
});